<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />

<link rel="stylesheet" type="text/css" href="<%=path%>/css/base.css" />
<script>
		  function check(){
		    var no = document.getElementById("roomno").value;
		    var regx = /^\d+$/gi;
		    if(!regx.test(no) && no!=""){
		       alert("宿舍号应为数字");
		       return false;
		    }
		    return true;
		  }
		  
		  function del(oid){
		    if(confirm("是否删除此数据?")){
		      window.location.href="<%=path%>/room!del.action?data.id="+oid;
		    }
		  }
		</script>
</head>

<body leftmargin="2" topmargin="2"
	background='<%=path%>/images/allbg.gif'>

	<table width="98%" border="0" cellpadding="2" cellspacing="1"
		bgcolor="#D1DDAA" align="center" style="margin-top: 8px">
		<tr bgcolor="#E7E7E7">
			<form action="<%=path%>/room!find.action" method="post"
				onsubmit="return check();">
				<td height="14" colspan="10" background="<%=path%>/images/tbg.gif"
					align="right">&nbsp;&nbsp; 
					<!--  区域:<input name="data.area" /> -->
					区域号:<select name="data.area">
					      <option>  </option>
						  <option>A区</option>
						  <option>B区</option>
						  <option>C区</option>
						  <option>D区</option>
						  <option>E区</option>
						
						</select>
						
					<!--  楼栋:<input name="data.flat" /> -->
					楼栋号:<select name="data.flat">
					      <option>  </option>
						  <option>1</option>
						  <option>2</option>
						  <option>3</option>
						  <option>4</option>
						  <option>5</option>
						  <option>6</option>
						  <option>7</option>
						  <option>8</option>
			
						</select>
					宿舍:<input name="data.roomno" id="roomno" />
					 <input type="submit" value="查询" />
				</td>
			</form>
		</tr>
		<tr align="center" bgcolor="#FAFAF1" height="22">

			<td >区域</td>
			<td >楼栋号</td>
			<td >房间号</td>
			<td >床位数</td>
			<td >未使用床位数</td>
			<c:if test="${loginUser.userType!='学生'}">
			<td>操作</td>
			</c:if>


		</tr>
		<c:forEach var="data" items="${all}">
			<tr align='center' bgcolor="#FFFFFF"
				onMouseMove="javascript:this.bgColor='red';"
				onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">

				<td bgcolor="#FFFFFF" align="center">${data.area}</td>
				<td bgcolor="#FFFFFF" align="center">${data.flat}栋</td>
				<td bgcolor="#FFFFFF" align="center">${data.roomno}</td>
				<td bgcolor="#FFFFFF" align="center">${data.num}</td>

				<td bgcolor="#FFFFFF" align="center">${data.freeNum}</td>

<c:if test="${loginUser.userType!='学生'}">
				<td bgcolor="#FFFFFF" align="center">
						<a href="<%=path%>/room!edit.action?data.id=${data.id }"
							class="pn-loperator">编辑</a>
						<a href="#" onclick="del(${data.id });" class="pn-loperator">删除</a>
		</td>			
</c:if>

			</tr>
		</c:forEach>
	</table>

</body>
</html>
